const { adminsModel } = require('./models/adminsModel.js');

//新增管理员
module.exports.addAdmins = async (admin) => {
    return await adminsModel.create(admin);
}

//获取所有管理员
module.exports.getAdmins = async () => {
    return await adminsModel.find();
}

//update
module.exports.editAdmins = async admin => {
    return await adminsModel.updateOne({ _id: admin._id }, admin);
}

//delete
module.exports.deleteAdmins = async admin => {
    return await adminsModel.deleteOne({ _id: admin._id });
}

//switch
module.exports.switchAdmins = async status => {
    return await adminsModel.updateOne({ _id: status._id },status);
}